#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

struct TreeNode {
     int val;
     TreeNode *left;
     TreeNode *right;
     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 };


class Solution {
public:
    bool hasPathSum(TreeNode *root, int sum) {
        if (!root)  return false;
        sum -= root->val;
        if (!root->left && !root->right) return sum == 0;
        if (hasPathSum(root->left, sum)) return true;
        if (hasPathSum(root->right, sum)) return true;
        return false; 
    }   
};

//pass all the test in leet code.

int main(int argc, char **argv)
{

}
